<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="height=device-height,width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no" />
<link href="img/css/css.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="js/QueryStringParser.js"></script>
<script type="text/javascript" src="js/jquery.json.min.js"></script>  
<script type="text/javascript" src="js/jsonMsg.js"></script> 
<title>好友列表</title>
</head>

<body>
<!--list group-->
<font id="contain">

</font>
</body>
</html>
<script type="text/javascript">
var latLon = "";
var openId = queryString.getParam("openid");
var innerContain = ""; 
$(document).ready(function(){
  	
	if(openId==null || openId==""){
		return false;	
	}else{
		var dataStr = {};	
		var bodyStr = popBody('ListFriends',dataStr);
		var request = popRequest('ListFriends',openId,bodyStr);
		//调用了jquery.json 库  
		var encoded = $.toJSON( request );  
		var jsonStr = encoded;  

		$.ajax({  
		url : actionStr,  
		type : 'POST',  
		data : jsonStr,  
		dataType : 'json',  
		contentType : 'application/json',  
		success : function(data, status, xhr) {  
		//         Do Anything After get Return data  
							if(data.portalResp.Data.Profiles){
			          $.each(data.portalResp.Data.Profiles, function(index){  
			          	if(index==0){
			          			$("#contain").html(innerContain);	
			          	}
			          	var sex = "男";
			          	if(data.portalResp.Data.Profiles[index].Sex=='female'){
			          		sex = "女";	
			          	}
			          	var imageURL = data.portalResp.Data.Profiles[index].ImageURL;
			          	if(imageURL.substring(imageURL.length-2)=="/0"){
			          			imageURL = imageURL.substring(0,imageURL.length-2)+"/64";
			          	}
			          	var province = data.portalResp.Data.Profiles[index].province==null?"":data.portalResp.Data.Profiles[index].province;
			          	var city = data.portalResp.Data.Profiles[index].city == null?"":data.portalResp.Data.Profiles[index].city;
			          	innerContain+=("<div class='list_group'>"); 
									innerContain+=("      <img width='50' height='50' src='"+imageURL+"' class='user_pic'>"); 
									innerContain+=("      <div class='list_text'>"); 
									innerContain+=("           <div class='list_title'>"+data.portalResp.Data.Profiles[index].NickName+"</div>"); 
									innerContain+=("           <div class='list_user_status'>"); 
									innerContain+=("                <p class='user'>"+sex+" "+province+" "+city+"</p>"); 
									innerContain+=("           </div>"); 
									innerContain+=("      </div>"); 
									innerContain+=("</div>");   
			          });  
			          $("#contain").html(innerContain);
		        	}
		},  
		Error : function(xhr, error, exception) {  
		    // handle the error.    
		    alert(exception.toString());  
		}  
		});  
	}
	
});

</script>